package com.laf.manager.dto;

import lombok.Data;
import org.springframework.jdbc.core.RowMapper;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Date;

/**
 * @author ygl
 * @create 2019-01-02
 * @DESCRIPTION
 * 积分抵扣停车费 记录
 **/
@Data
public class PointsDeduction implements RowMapper<PointsDeduction>, Serializable {
    private int id;

    /**
     * 抵扣编号
     */
    private String offsetNumber;
    /**
     * 会员ID
     */
    private int memberId;
    /**
     * 车牌号
     */
    private String carNumber;
    /**
     * 总金额
     */
    private double totalCost;
    /**
     * 抵扣金额
     */
    private int deductionCost;
    /**
     * 抵扣积分
     */
    private int deductionPoints;
    /**
     * 状态:1:冻结。2：实扣。3：撤销
     */
    private int status;
    /**
     * 冻结时间
     */
    private Date frozenDate;
    /**
     * 实扣／撤销时间
     */
    private Date bizDate;

    @Override
    public PointsDeduction mapRow(ResultSet rs, int rowNum) throws SQLException {
        PointsDeduction model = new PointsDeduction();
        model.setId(rs.getInt("id"));
        model.setOffsetNumber(rs.getString("offset_number"));
        model.setMemberId(rs.getInt("member_id"));
        model.setCarNumber(rs.getString("car_number"));
        model.setTotalCost(rs.getDouble("total_cost"));
        model.setDeductionCost(rs.getInt("deduction_cost"));
        model.setDeductionPoints(rs.getInt("deduction_points"));
        model.setStatus(rs.getInt("status"));
        model.setFrozenDate(rs.getDate("frozen_date"));
        model.setBizDate(rs.getDate("biz_date"));
        return model;
    }
}
